<?php

namespace Shopadmin\Controller;
class StatisticsController extends AdminController
{
    public function user_statistics_list()
    {
        $shop_id = session("shopid");
        $search = I("search", "");
        $where['shop_id'] = $shop_id;
        if (!empty($search)) {
            $where['order_number'] = array('like', "%$search%");
            $where['_logic'] = 'AND';
        }
        $count = M("wx_user")->where($where)->count();
        $Page = new \Think\Page($count, 10);
        $list = M("wx_user")->where($where)->limit($Page->firstRow . ',' . $Page->listRows)->order("id desc")->select();
        foreach ($list as &$v) {
            $v['addtime'] = timeString($v['addtime']);
            if($v['sex']==0){
                $v['sex']="未填写";
            }
            else if($v['sex']==1){
                $v['sex']="男";
            }
          else{
              $v['sex']="女";
          }


        }
        $this->assign("pages", $Page->show());
        $this->assign("search", $search);
        $this->assign("list", $list);
        $this->display();

    }
}
